home *** CD-ROM | disk | FTP | other *** search
- /*
- * Automatic project help
- *
- * seeks the $Helpfile = myfile tag like locale.wrx does
- * sees if the xrefs are loaded, if not loads them and gets
- * the help for the word under the cursor
- *
- * The file given by $Helpfile must not be the real AmigaGuide
- * file but the corresponding XRefs.
- *
- * The function may be passed a parameter. If the parameter equals
- * RELOAD then the only action is to reload the XRef table, after e.g.
- * a change due to a remake.
- *
- * The file may also be passed directly as the second parameter.
- * This is especially useful to reload XRefs from without WRITE
- *
- * © 1994 by Lars Hanke, MGR-Asgard
- *
- * 01/03/1994 first written
- *
- */
-
- ARG action file
-
- if action = "RELOAD" then reload = 1
- else reload = 0
-
- if (reload = 1) & (file ~= "") then relfil = 1
- else relfil = 0
-
- OPTIONS RESULTS
-
- if relfil = 0 then
- do
- IF ~SHOW('P','WRITE') then
- do
- say "This script is for use with the WRITE editor"
- exit 0
- end
-
- address 'WRITE'
-
- 'VERSIONCHECK 31090 "ProjDoc.wrx"'
- IF RC~=0 THEN DO
- exit 10
- END
-
- end
-
- IF reload = 0 then
- do
- 'GetVar (_CurrentWord)'
- word = RESULT
- err = RC
- do while ((word = "RESULT") & (err = 0))
- 'CursorLeft 0'
- err = RC
- 'GetVar (_CurrentWord)'
- word = RESULT
- end
- if err ~= 0 then
- do
- 'MessageOK (You must have a word in the active window!)'
- exit 0
- end
- end
-
- if relfil = 0 then
- do
- 'GetVar (_FilePath)'
- path = RESULT
-
- call pragma(DIRECTORY,path)
- end
-
- IF ~SHOW('L','amigaguide.library') THEN
- CALL ADDLIB('amigaguide.library',0,-30)
-
- if relfil = 1 then
- do
- call LoadXRef(file)
- exit(0)
- end
-
- if reload = 0 then
- do
- function = word||'()'
-
- line = GetXRef(word)
- IF line = 10 THEN
- line = GetXRef(function)
- end
- else line = 10
-
- IF line = 10 THEN DO
- /* Now let's see if we still have to load our XRefs */
- 'GetVar (_XPos)'
- x = RESULT
- 'GetVar (_YPos)'
- y = RESULT
-
- 'SetVar (_FindString) ($Helpfile)'
- 'Find 1 1 @EOT @EOT {@SILENT}'
- if RC = 0 then
- do
- 'GetVar (_CurrentLine)'
- line = RESULT
- line = substr(line,pos("$Helpfile",line))
- line = delword(line,1,1)
- do i=1 until cnt = 0
- ch = substr(line,i,1)
- if ((ch = ':') | (ch = '=') | (ch = ' ')) then cnt = 1
- else cnt = 0
- end
- line = substr(line,i)
- line = word(line,1)
-
- 'MessageOK (Ich lade jetzt nicht!)'
- call LoadXRef(line)
- end
-
- 'Goto' x y
-
- if reload = 0 then
- do
- line = GetXRef(word)
- IF line = 10 THEN
- line = GetXRef(function)
- end
-
- END
-
- if reload = 1 then exit 0
-
- if line ~= 10 then
- do
- parse var line node file xref offset
- node = compress(node,'"')
- file = compress(file,'"')
- call ShowNode(,file,node,offset,xref)
- end
- else do
- cmd = "run MultiView "||function
- ADDRESS COMMAND cmd
- END
-
-
-